<?php
class DelFrag extends Action {
	/*
	 * (non-PHPdoc) @see Action::execute()
	 */
	public function execute($params) {
		check_login ( ADMIN_LOGIN_PAGE );
		$ids = rqst ( 'fid' );
		if (! empty ( $ids )) {
			$ids = safe_ids ( $ids, ",", true );
			$ftM = new WebFragmentModel ();
			$rst = $ftM->delete ( array ('fragment_id IN' => $ids ) );
			if ($rst === false) {
				sess_add ( 'page_tip_info', '删除代码片断出错：' . $ftM->last_error_msg () );
			}
		} else {
			sess_add ( 'page_tip_info', '未指定要删除的代码片断.' );
		}
		Response::redirect ( $this->referer );
	}
}